home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1991 / Jan 91 / MacApp.Tech$ 1⁄18⁄91 / 2713-Re Contest-Jan91 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.6 KB  |  53 lines  |  [TEXT/GEOL]

  1. Item    8362597                         17-Jan-91        11:57PST
  2.  
  3. From:   KNEPPER                         Knepper, Christopher
  4.  
  5. To:     POWERUP.ENG                     Power Up Software,PRT
  6.  
  7. cc:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. ------------------------------------------------------------------------------
  10.  
  11. Sub:    Re: Contest
  12.  
  13. James,
  14.  
  15. I'd like to help out those who prepare entries for your contest.
  16.  
  17. >The contest is to write a subclass of TPicture, TAspectPicture,  that draws
  18. >its picture with its original proportions (neither squashed nor stretched),
  19. >centered in the TPicture's rectangle.  In every other respect the control
  20. >should be drawn (and otherwise behave) just as does a TPicture.
  21. >
  22. >The thing that makes this difficult is Object Pascal's lack of a scope
  23. >resolution feature.  Ideally, one would simply override TPicture.Draw()
  24. >replacing it with the desired functionality, and then call TControl's Draw(),
  25. >which handles adornment, hiliting, and dimming.  But, to my knowledge, you
  26. >can't do that in Object Pascal.
  27.  
  28. Here's a clue as to how to call INHERITED Draw from within TAspectPicture.Draw
  29. and not get the functionality of TPicture.Draw, but instead to get the
  30. functionality needed in TControl.Draw:
  31.  
  32. PROCEDURE TAspectPicture.Draw(area: Rect); OVERRIDE;
  33.  
  34.  VAR
  35.   saveDataHandle: PicHandle;
  36.  
  37.    BEGIN
  38.  { 1st. draw the picture "correctly" }
  39.  …fill in this blank…
  40.  
  41.  { 2nd. (the hard part!) call INHERITED Draw without having TPicture.Draw do
  42.     anything }
  43.  saveDataHandle := fDataHandle;
  44.  fDataHandle := NIL;
  45.    INHERITED Draw(area);
  46.  fDataHandle := saveDataHandle;
  47.  END;
  48.  
  49. May the best man/woman win!
  50.  
  51. -Chris
  52.  
  53.